﻿using System.Data;

namespace ltModel.BLL
{
    /// <summary>
    /// 业务逻辑类article_class 的摘要说明。
    /// </summary>
    public class article_class
    {
        private readonly ltModel.DAL.article_class dal = new ltModel.DAL.article_class();
        public article_class()
        { }
        #region  成员方法
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(int class_id)
        {
            return dal.Exists(class_id);
        }

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(ltModel.Model.article_class model)
        {
            return dal.Add(model);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(ltModel.Model.article_class model)
        {
            return dal.Update(model);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(int class_id)
        {
            return dal.Delete(class_id);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ltModel.Model.article_class GetModel(int class_id)
        {
            return dal.GetModel(class_id);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            return dal.GetList(strWhere);
        }

        /// <summary>
        /// 获得数据列表
        /// <param name="topNum">获取记录条数</param>
        /// <param name="strWhere">条件</param>
        /// </summary>
        public DataSet GetList(string topNum, string strWhere)
        {
            return dal.GetList(topNum, strWhere);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetAllList()
        {
            return dal.GetList("");
        }

        /// <summary>
        /// 修改类别排序,返回新序号
        /// </summary>
        /// <param name="fid">父ID</param>
        /// <param name="px">原类别序列</param>
        /// <returns></returns>
        public int UpdateClassPx(int fid, int px)
        {
            return dal.UpdateClassPx(fid, px);
        }

        /// <summary>
        /// 返回类别最大序号
        /// </summary>
        /// <returns></returns>
        public int MaxPx()
        {
            return dal.MaxPx();
        }

        /// <summary>
        /// 查询单类别最大排序
        /// </summary>
        /// <param name="cid">类别ID</param>
        /// <returns></returns>
        public int ClassMaxPx(int cid)
        {
            return dal.ClassMaxPx(cid);
        }

        /// <summary>
        /// 修改类别属性(是否有子类)
        /// </summary>
        /// <param name="val">修的改值</param>
        /// <param name="classid">修改类别ID</param>
        /// <returns></returns>
        public bool UpdateSubClass(int val, int classid)
        {
            return dal.UpdateSubClass(val, classid);
        }

        /// <summary>
        /// 修改类别排序
        /// </summary>
        /// <param name="px">原类别序列</param>
        /// <returns></returns>
        public bool UpdateClassPx(int px)
        {
            return dal.UpdateClassPx(px);
        }

        #endregion  成员方法
    }
}